<template>
	<view class="page page-index">
		<fy-dropdown :menuList="menuList" :H5-nav-bar-height="94">
			<fy-dropdown-item v-model="synthesisValue" dropdownKey="synthesis" :options="columnOptions" type="column" @change="handlerColumnChange"></fy-dropdown-item>
			<fy-dropdown-item v-model="synthesisValue" dropdownKey="synthesis" :options="columnOptions" type="column" @change="handlerColumnChange"></fy-dropdown-item>
			<fy-dropdown-item v-model="priceValue" dropdownKey="price" :options="priceOptions" @change="handlerTypeChange"></fy-dropdown-item>
		</fy-dropdown>
		
	</view>
</template>

<script>
export default {
	name: "own-select",
	data() {
		return {
			menuList: [{ title: '全部价格', dropdownKey: 'synthesis' }, { title: '全部房间', dropdownKey: 'price' }, { title: '总价升序', dropdownKey: 'sales' },{ title: '筛选', dropdownKey: 'right' }],
			synthesisValue: '',
			columnOptions: [
				{ title: '任务类型', key: 'type', default: '', list: [{ text: '全部', value: '' }, { text: '类型1', value: '2' }, { text: '类型2', value: '1' }] },
				{ title: '任务状态', key: 'status', default: '', list: [{ text: '全部', value: '' }, { text: '已完结', value: '1' }, { text: '工作中', value: '2' }] },
			],
			priceValue: 1,
			priceOptions: [{ label: '最早跟进', value: 1 }, { label: '最新创建', value: 2 }, { label: '最早创建', value: 3 }, { label: '最新认购', value: 4 }, { label: '最新签约', value: 5 }],
			salesValue: '',
			salesOptions: [{ label: '筛选条件3', value: 1 }, { label: '筛选条件33', value: 2 }, { label: '筛选条件333', value: 3 }],
		}
	},
	methods: {
		handlerColumnChange(e) {
			if (e.cancel) return;
			
			this.columnOptions.forEach(item=>{
				item.default = e.data[item.key];
			})
		},
		handlerTypeChange(e) {
			console.log(e)
				
			this.priceOptions.forEach((res)=>{
				if(res.value==e){
					console.log(res.label)
					this.menuList[1].title = res.label
				}
			})
			
		},
	}
}
</script>
<style lang="scss" scoped>
	.page-index {
		margin-top: 20rpx;
		position: relative;		
	}
</style>
